/**
 * 该文件用于发送axios请求
 */
import { http } from "../plugins/axios";

export interface User {
  Id: string;
  LoginName: string;
  Password: any;
  ShiCode: string;
  XianCode: string;
  DeptCode: string;
  RoleId: string;
  Name: string;
  PhoneNum: string;
  CardNum: string;
  PliceNum: string;
  Permission: string[];
}

interface LoginInterface {
  token: string;
  user: User;
}

export interface IloginData {
  loginName: string;
  password: string;
}

class userApi {
  info() {
    return http.request<User>({
      //线上环境
      //url: "/api/Login/Getname",
      //测试环境
      url:'Login/GetnameTest',
      method: "post",
      params: { loginName: "admin" },
    });
  }

  login(data: IloginData) {
    return http.request<LoginInterface>({
      //前后台测试环境(务必在api前加上'/')
      //url: "/api/Login/GetLogin",
      //本地测试环境
      url: 'loginTest',
      method: "post",
      params: data,
    });
  }
}

export default new userApi();
